//
//  CollectionViewController.h
//  liwo
//
//  Created by liuwenyang on 14-9-19.
//  Copyright (c) 2014年 liuwenyang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "LBEasyCollectionViewCell.h"
@class LBEasyCollectionController;
@protocol LBEasyCollectionControllerDelegate <NSObject>

@optional
- (void)didClickElementForItem:(LBEasyCollectionController *)controller element:(id)element data:(id)data;
- (void)didSelectedCell:(LBEasyCollectionController *)controller dataSrc:(id)dataSrc index:(NSIndexPath *)index;
- (void)beforeConfigWithCollectionController:(LBEasyCollectionController *)controller collectionCell:(LBEasyCollectionViewCell *)collectionCell data:(id)data;
- (void)modelDidLoadFinished:(LBEasyCollectionController *)controller;
@end


@interface LBEasyCollectionController : NSObject<UICollectionViewDelegate, UICollectionViewDataSource,LBEasyCollectionViewCellDelegate>

@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong) NSMutableArray *dataSource;
@property (nonatomic, weak) id<LBEasyCollectionControllerDelegate> delegate;
@property (nonatomic, strong) UICollectionViewFlowLayout *flowLayout;
@property (nonatomic, strong) Class classForItem;
-(instancetype)initWithCellForItem:(Class)classForItem;

@end


@interface LBEasyRefleshCollectionController : LBEasyCollectionController


-(id)initWithDragRefresh:(BOOL)enableDragRefresh withInfiniteScroll:(BOOL)enableInfiniteScroll classForItem:(Class)classForItem;

@property (nonatomic, assign) NSInteger pageIndex;
@property (nonatomic, assign) NSInteger totalPages;
@property (nonatomic, assign) NSInteger totalCount;
- (void)refreshTable:(void (^)(BOOL finished))block;
- (void)getTableMore:(void (^)(BOOL finished))block;

//强制模拟下拉刷新
- (void)forceRefresh;
-(void)forceRefreshWithoutAnimation;
@end




